home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / OTFIRE.ZIP / fire.doc < prev    next >
Text File  |  1996-01-10  |  5KB  |  97 lines

  1.  
  2.                       - THE OUTLAW TRIAD DEMO-SERIES -
  3.  
  4. ─────────────────────────────────■ PART I ■──────────────────────────────────
  5.  
  6.                            Written by : Vulture/OT
  7.                            Code in    : Pascal/Asm
  8.                            Topic      : Fire effect
  9.  
  10. ──────────────────────────────■ Introduction ■───────────────────────────────
  11.  
  12.  Welcome to the Outlaw Triad demo-series! In these series we will be talking
  13.  about programming demo-effects in either pascal or assembler. Theory behind
  14.  the effects shall be discussed while a full sourcecode is also provided.
  15.  These series are the sequals to the VGA-VUL# releases in which a few demo
  16.  effects were handled and are meant for the beginner and intermediate coder.
  17.  From now on all demo tutorials from Outlaw Triad will be released in these
  18.  series. We from Outlaw Triad know there are already large amounts of demo
  19.  trainers available (best of which seem to be the ones by Denthor/Asphyxia)
  20.  but we experienced that it can be helpfull to read more than one document
  21.  on the same subject. Enjoy these series!
  22.  
  23. ─────────────────────────────────■ Theory ■──────────────────────────────────
  24.  
  25.  In this very first release I will cover a wellknown effect... FIRE!
  26.  This is actually a simple routine, in theory. The only math is takes
  27.  are some simple calculations to avarage certain values. Here we go:
  28.  
  29.  We will be using an unchained vgascreen with resolution 320*200*256.
  30.  This will speed up our routine by a factor of 4 because we can plot
  31.  4 pixels at a time due to vga-hardware. Now you need to setup a nice
  32.  palette for use in our fire. E.g from dark red to bright yellow.
  33.  
  34.  Ok, we will also be using a 100 scanlines for our fire. This way, you
  35.  will have another 100 scanlines left to do other things with.
  36.  Create an array large enough to hold this data. We then flip the data to
  37.  the vga. Why use an array? Because vga-memory is a lot slower than normal
  38.  memory! In this case it is faster to update data in pc-memory and then
  39.  flip it to the vga. This can also avoid flickering.
  40.  Now, on the last row, put random values between 0 and 255 (or whatever
  41.  colorrange you want. I used 0..85). Then create a fire effect like this:
  42.  
  43.  Start with the first pixel (actually 4 pixels) on the second row. Then
  44.  take the 3 pixels above, the 3 pixels below and the 2 pixels besides that
  45.  pixel. Divide by 3+3+2=8 to avarage these values. If the found value is not
  46.  zero, decrease it by 1 to fade the fire to black. The fire on the bottom
  47.  will then be brighter than the fire at the top which will make a good fire
  48.  routine. Store the found value in the pixel ABOVE the current pixel. This
  49.  will make the flames go up. Then point to the next pixel on the line and do
  50.  the same. Do this for all lines. When finished, wait for a vertical retrace,
  51.  flip the data to the vga screen and start over. That's it!
  52.  In steps:
  53.  
  54.    - set bottom line with random values
  55.    - start avaraging from second line
  56.    - do all lines
  57.    - wait for vertical retrace
  58.    - flip to vga
  59.  
  60.  One thing left to say... As the bottom line is rather ugly with it's
  61.  random values scattered on it, we hide the last few lines on the second
  62.  page in display memory. Offscreen memory can be handy indeed! ;-)
  63.  
  64.  So you see, it's not that hard to understand. What can be hard is to realy
  65.  code it. Take a look at the source to see how it can be done. The code here
  66.  is in assembler because that is the real democode language to use, IMHO.
  67.  There are many fire trainers available, so if you don't understand it, go
  68.  study some more of them. Btw, thanks must go to all who have release fire
  69.  code before I did (I learned from tutors too, you know ;-) ).
  70.  
  71.  Ok, this is all for now. Happy coding!
  72.  
  73.        - Vulture / Outlaw Triad
  74.  
  75. ───────────────────────────────■ Distro Sites ■──────────────────────────────
  76.  
  77.  Call our distros to get all our releases.
  78.  
  79.   BlueNose    World HQ     +31 (0)345-619401
  80.   FireHouse   Distrosite   +31 (0)528-274176         More distros wanted!
  81.   The Force   Distrosite   +31 (0)36-5346967
  82.   MagicWare   Italian HQ   +39  6-52355532
  83.  
  84. ──────────────────────────────────■ Contact ■────────────────────────────────
  85.  
  86.  Want to contact Outlaw Triad for some reason? You can reach us at our
  87.  distrosites in Holland. Or if you have e-mail access, mail us:
  88.  
  89.    Vulture  (coder/pr)     comma400@tem.nhl.nl
  90.  
  91.  Our internet homepage:
  92.  
  93.    httm://www.tem.nhl.nl/~comma400/vulture.html
  94.  
  95.  These internet adresses should be valid at least till june 1996.
  96.  
  97. ──────────────────────────────────────────────────────────────────────────────